<div class="row">
    <div class="col-sm-20">
        <h1 class="pagetitle" translate lib="web">oauthclient</h1>
    </div>
</div>

<pre ng-show="ErrorMessage!=null">{{ ErrorMessage }}</pre>
<div ng-show="ctrl.errormessage != ''"" class=" alert alert-danger" role="alert">{{ctrl.errormessage}}</div>
<form ng-submit="ctrl.submit()" class="form-horizontal" role="form" autocomplete="off">
    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">name</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.name" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group">
        <label for="clientId" class="col-sm-2 control-label" translate lib="web">clientId</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.clientId" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>
    <div class="form-group">
        <label for="clientSecret" class="col-sm-2 control-label" translate lib="web">clientSecret222</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.clientSecret" class="form-control input-md"
                ng-disabled="ctrl.loading==true" id="clientSecret" type="password"/>

        </div>
    </div>
    <div class="form-group">
        <label for="grants" class="col-sm-2 control-label" translate lib="web">grants</label>
        <table style="width: 50%;" class="table table-striped">
            <tr ng-repeat="id in ctrl.model.grants">
                <td style="width: 15px;"></td>
                <td>{{ id }}</td>
                <td><a href="" ng-click="ctrl.deletefromarray('grants', id)" translate lib="web">delete</a></td>
            </tr>
        </table>
    </div>
    <div class="form-inline">
        <div class="mx-sm-3 mb-4">
            <input ng-model="newgranttype" type="text" class="form-control" placeholder="New grant type"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true"
            ng-click="ctrl.addtoarray('grants', newgranttype)" translate lib="web">addgrant</button>
    </div>


    <div class="form-group">
        <label for="redirectUris" class="col-sm-2 control-label" translate lib="web">redirecturis</label>
        <table style="width: 50%;" class="table table-striped">
            <tr ng-repeat="id in ctrl.model.redirectUris">
                <td style="width: 15px;"></td>
                <td>{{ id }}</td>
                <td><a href="" ng-click="ctrl.deletefromarray('redirectUris', id)" translate lib="web">delete</a></td>
            </tr>
        </table>
    </div>
    <div class="form-inline">
        <div class="mx-sm-3 mb-4">
            <input ng-model="newredirecturi" type="text" class="form-control" placeholder="New redirect Uri"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true"
            ng-click="ctrl.addtoarray('redirectUris', newredirecturi)" translate lib="web">addredirecturi</button>
    </div>



    <div class="form-group">
        <label for="defaultrole" class="col-sm-2 control-label" translate lib="web">defaultrole</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.defaultrole" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>

    <div class="form-group">
        <label for="rolemappings" class="col-sm-2 control-label" translate lib="web">rolemappings</label>
        <table style="width: 50%;" class="table table-striped">
            <thead>
                <tr>
                    <th></th>
                    <th><strong translate lib="web">openflow role</strong></th>
                    <th><strong translate lib="web">target role</strong></th>
                    <th></th>
                </tr>
            </thead>
            <tr ng-repeat="(key, value) in ctrl.model.rolemappings">
                <td style="width: 15px;"></td>
                <td>{{ key }}</td>
                <td>{{ value }}</td>
                <td><a href="" ng-click="ctrl.deleterolemapping(key)" translate lib="web">delete</a></td>
            </tr>
        </table>
    </div>
    <div class="form-inline">
        <div class="mx-sm-3 mb-4">
            <input ng-model="newrolemappingname" type="text" class="form-control" placeholder="openflow role name"
                autocomplete="new-password">
            <input ng-model="newrolemappingvalue" type="text" class="form-control" placeholder="oauth role name"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true"
            ng-click="ctrl.addrolemapping(newrolemappingname, newrolemappingvalue)" translate
            lib="web">addrolemapping</button>
    </div>


    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" ng-disabled="ctrl.loading==true" class="btn btn-success" translate
                lib="web">Save</button>
        </div>
    </div>

    <div class="form-group">
        <label for="defaultrole" class="col-sm-2 control-label" translate lib="web">openflow signout</label>
        <div class="col-sm-4">
            <input type="checkbox" ng-model="ctrl.model.openflowsignout" class="input-md"
                ng-disabled="ctrl.loading==true" />
        </div>
    </div>

    <div class="form-group">
        <label for="name" class="col-sm-2 control-label" translate lib="web">Signin URL</label>
        <div class="col-sm-4">
            <input ng-model="ctrl.model.signin_url" class="form-control input-md" ng-disabled="ctrl.loading==true" />
        </div>
    </div>

    <div class="form-group">
        <label for="defaultrole" class="col-sm-2 control-label" translate lib="web">token_endpoint_auth_method</label>
        <div class="col-sm-4">
            <select ng-model="ctrl.model.token_endpoint_auth_method" class="form-control input-md"
                ng-disabled="ctrl.loading==true">
                <option>none</option>
                <option>client_secret_post</option>
                <option>client_secret_basic</option>
                <option>private_key_jwt</option>
                <option>tls_client_auth</option>
            </select>
        </div>
    </div>


    <div class="form-group">
        <label for="response_types" class="col-sm-2 control-label" translate lib="web">response_types</label>
        <table style="width: 50%;" class="table table-striped">
            <tr ng-repeat="id in ctrl.model.response_types">
                <td style="width: 15px;"></td>
                <td>{{ id }}</td>
                <td><a href="" ng-click="ctrl.deletefromarray('response_types', id)" translate lib="web">delete</a></td>
            </tr>
        </table>
    </div>
    <div class="form-inline">
        <div class="mx-sm-3 mb-4">
            <input ng-model="newresponsetype" type="text" class="form-control" placeholder="New response type"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true"
            ng-click="ctrl.addtoarray('response_types', newresponsetype)" translate lib="web">addresponsetype</button>
    </div>


    <div class="form-group">
        <label for="post_logout_redirect_uris" class="col-sm-2 control-label" translate
            lib="web">post_logout_redirect_uris</label>
        <table style="width: 50%;" class="table table-striped">
            <tr ng-repeat="id in ctrl.model.post_logout_redirect_uris">
                <td style="width: 15px;"></td>
                <td>{{ id }}</td>
                <td><a href="" ng-click="ctrl.deletefromarray('post_logout_redirect_uris', id)" translate
                        lib="web">delete</a></td>
            </tr>
        </table>
    </div>
    <div class="form-inline">
        <div class="mx-sm-3 mb-4">
            <input ng-model="newpostredirecturi" type="text" class="form-control" placeholder="New redirect Uri"
                autocomplete="new-password">
        </div>
        <button type="button" class="btn btn-success mb-2" ng-disabled="ctrl.loading==true"
            ng-click="ctrl.addtoarray('post_logout_redirect_uris', newpostredirecturi)" translate
            lib="web">addpostredirecturi</button>
    </div>

</form>